package cn.itsource.basic.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.bytebuddy.asm.Advice;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class AjaxResult{
    private Boolean success = true;
    private String message = "操作成功";
    //备用字段
    private Object resultObj;

    //拓展
    public static AjaxResult me(){
        return new AjaxResult();
    }
    /*链式写法*/
    public AjaxResult setSuccess(Boolean success){
        this.success = success;
        return this;
    }

    public AjaxResult setMessage(String message) {
        this.success = false;
        this.message = message;
        return this;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }
}
